	$.ajaxSetup({
	    headers: {
	        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
	    }
	});

	$.getUrlParam = function(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r!=null) return unescape(r[2]); return null;
    }

    $.errorAlert = function(val)
    {
    	layer.msg(val);
    }

    $.successAlert = function(val)
    {
    	layer.msg(val+'  3秒后自动跳转');
    }

    $.isEmail = function (email)
    {
      var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;

      return regex.test(email);
    }

    $.clearAlert = function()
    {
        setTimeout(function (){$('.errorAlert').remove()}, 3000)
    }

    $.addLayerExt = function()
    {
        layer.config({
            extend: 'extend/layer.ext.js'
        });  
    }